
      * This is an annotated version of the previous VARARGS example.
       PROGRAM-ID. VARARGS.
       CONFIGURATION SECTION.
       REPOSITORY.
           CLASS J-ARR  AS "java.lang.Object[]"
           CLASS J-CHR  AS "java.lang.Character"
           CLASS J-DBL  AS "java.lang.Double"
           CLASS J-MATH AS "java.lang.Math"
           CLASS J-STR  AS "java.lang.String"
           CLASS J-SYS  AS "java.lang.System"
           .
       WORKING-STORAGE SECTION.
       01  WS-ARRAY  OBJECT REFERENCE J-ARR.
       PROCEDURE DIVISION.
      *> Where a Java function such as System.out.format takes varargs,
      *> isCOBOL requires you to pass an array. An array can be created
      *> and initialized as follows:
           SET WS-ARRAY    TO J-ARR:>new(3)
           SET WS-ARRAY(0) TO J-STR:>new("pi")
           SET WS-ARRAY(1) TO J-CHR:>new("=")
           SET WS-ARRAY(2) TO J-DBL:>new(J-MATH:>PI)

      *> Here's one way of calling System.out.format:
           J-SYS:>out:>format("%s%c%f%n", WS-ARRAY)
      *> The other supported syntax in isCOBOL is:    
           INVOKE J-SYS:>out "format" USING "%s%c%f%n", WS-ARRAY
 
      *> Where necessary, the INVOKE statement can be explicitly
      *> terminated with the END-INVOKE end marker, e.g.:
           INVOKE
             J-SYS:>out "format" USING "%s%c%f%n", WS-ARRAY
           END-INVOKE
      *> The INVOKE statement must be explicitly terminated in cases
      *> where the next statement does not begin with a command, e.g.:
           J-SYS:>out:>format("%s%c%f%n", WS-ARRAY)

      *> Alternatively, you can terminate an INVOKE statement with a
      *> period. However, I try to avoid using periods except where
      *> absolutely required by COBOL syntax. As Gary DeWard Brown
      *> says, periods are like little landmines.

           GOBACK.
